using System.ComponentModel.Composition;
using EveIntel.API;
using EveIntel.API.Base;
using EveIntel.API.Enums;
using EveIntel.API.Interfaces;

namespace StaticMapperProvider
{
    using System.Globalization;
    using System;

    /// <summary>
    /// Static mapper intel provider
    /// </summary>
    [Provider]
    [Export(typeof(IIntelProvider))]
    public sealed class StaticmapperProvider : IntelProviderBase
    {
        private const string SYSTEM_URL = "http://www.staticmapper.com/index.php?system={0}";

        public StaticmapperProvider()
            : base(new Guid("63706D69-31C1-4C44-AB1A-D47660AA1215"))
        {
        }

        /// <summary>
        /// Obtains a data provider description
        /// </summary>
        public override string Description
        {
            get { return "www.staticmapper.com"; }
        }
        /// <summary>
        /// Obtains the URI to navigate to
        /// </summary>
        /// <param name="type">The IntelTypeEnum value</param>
        /// <param name="args">Additional arguments needed to build the uri</param>
        /// <returns></returns>
        public override Uri GetUri(IntelTypeEnum type, string[] args)
        {
            if (!CanProvideIntel(type)) return null;
            return new Uri(string.Format(CultureInfo.InvariantCulture, SYSTEM_URL, args[0]));
        }
        /// <summary>
        /// Determines if the data provider can handle a type of intel request
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public override bool CanProvideIntel(IntelTypeEnum type)
        {
            return type == IntelTypeEnum.SolarSystem;
        }
    }
}